﻿Imports System.Windows.Input
Imports Infragistics.Windows.Ribbon
Imports Microsoft.Practices.Composite.Regions
Imports Hinshelwood.TFSStickyBuddy.Infrastructure.Interfaces
Imports System.Collections.ObjectModel

<Obsolete("Use NavigationService instead", True)> _
Public Class InfragisticsHelper

    Private Sub New()

    End Sub

    <Obsolete("Use NavigationService instead", True)> _
    Public Shared Sub RegisterTabRegion(ByVal Header As String, ByVal rmShell As IRegionManager, ByVal newRegionName As String)
        'Get the ribbon region
        Dim region As IRegion = rmShell.Regions(RegionNames.Shell_Ribbon)
        ' Create a new toolbar for Team System
        Dim tsrti As New RibbonTabItem
        tsrti.Header = Header
        ' Add the Tab as a regionable region and get the region manager for it.
        region.Add(tsrti, String.Format("{0}View", newRegionName))
        ' Defign the inner region
        rmShell.AttachNewRegion(tsrti, newRegionName)

    End Sub

    <Obsolete("Use NavigationService instead", True)> _
    Public Shared Sub RegisterApplicationMenuTool(ByVal Caption As String, ByVal rmShell As IRegionManager, ByVal newRegionName As String)
        'Get the ribbon region
        Dim region As IRegion = rmShell.Regions(RegionNames.Shell_RibbonApplicationMenu)
        Dim MenuTool As New MenuTool
        MenuTool.Caption = Caption
        MenuTool.ButtonType = MenuToolButtonType.DropDown
        region.Add(MenuTool)
        ' Defign the inner region
        rmShell.AttachNewRegion(MenuTool, newRegionName)
    End Sub

    <Obsolete("Use NavigationService instead", True)> _
    Public Shared Sub AddApplicationSeperator(ByVal rmShell As IRegionManager)
        'Get the ribbon region
        Dim region As IRegion = rmShell.Regions(RegionNames.Shell_RibbonApplicationMenu)
        Dim tool As New SeparatorTool
        region.Add(tool)
    End Sub

    <Obsolete("Use NavigationService instead", True)> _
    Public Shared Sub RegisterRibbonGroup(ByVal Caption As String, ByVal rmShell As IRegionManager, ByVal tabRegionName As String, ByVal newRegionName As String)
        Dim tsrgServer As New RibbonGroup
        tsrgServer.Caption = Caption
        Dim region As IRegion = rmShell.Regions(tabRegionName)
        region.Add(tsrgServer)
        rmShell.AttachNewRegion(tsrgServer, newRegionName)
    End Sub

    <Obsolete("Use NavigationService instead", True)> _
    Public Shared Sub AddButtonTool(ByVal Caption As String, ByVal Command As ICommand, ByVal CommandParam As Object, ByVal ParamArray Regions() As IRegion)
        For Each region In Regions
            Dim newButtonTool As New ButtonTool
            newButtonTool.Caption = Caption
            newButtonTool.Command = Command
            newButtonTool.CommandParameter = CommandParam
            region.Add(newButtonTool)
        Next
    End Sub

    <Obsolete("Use NavigationService instead", True)> _
    Public Shared Sub AddButtonTool(ByVal Caption As String, ByVal Command As ICommand, ByVal CommandParam As Object, ByVal rmShell As IRegionManager, ByVal ParamArray RegionNames() As String)
        For Each regionName In RegionNames
            Dim Region As IRegion = rmShell.Regions(regionName)
            Dim newButtonTool As New ButtonTool
            newButtonTool.Caption = Caption
            newButtonTool.Command = Command
            newButtonTool.CommandParameter = CommandParam
            Region.Add(newButtonTool)
        Next
    End Sub

    <Obsolete("Use NavigationService instead", True)> _
    Public Shared Sub AddRadioButtonTool(ByVal Caption As String, ByVal IsChecked As Boolean, ByVal Command As ICommand, ByVal CommandParam As Object, ByVal rmShell As IRegionManager, ByVal ParamArray RegionNames() As String)
        For Each regionName In RegionNames
            Dim Region As IRegion = rmShell.Regions(regionName)
            Dim newTool As New RadioButtonTool
            newTool.Caption = Caption
            newTool.Command = Command
            newTool.IsChecked = IsChecked
            newTool.CommandParameter = CommandParam
            Region.Add(newTool)
        Next
    End Sub

    <Obsolete("Use NavigationService instead", True)> _
    Public Shared Sub AddLabelTool(ByVal Caption As String, ByVal ParamArray Regions() As IRegion)
        For Each region In Regions
            Dim LabelTool As New LabelTool
            LabelTool.Caption = Caption
            region.Add(LabelTool)
        Next
    End Sub

    <Obsolete("Use NavigationService instead", True)> _
    Public Shared Sub AddLabelTool(ByVal Caption As String, ByVal rmShell As IRegionManager, ByVal ParamArray RegionNames() As String)
        For Each regionName In RegionNames
            Dim Region As IRegion = rmShell.Regions(regionName)
            Dim LabelTool As New LabelTool
            LabelTool.Caption = Caption
            Region.Add(LabelTool)
        Next
    End Sub

End Class
